import { createApp } from 'vue'
import {
  Button, Toast, Cell, CellGroup, Icon, Tabbar, TabbarItem, Swiper, SwiperItem,
  Grid, GridItem, InfiniteLoading, Layout, Row, Col, Switch, Avatar,
  Menu, MenuItem, Input, Form, FormItem, Sticky, Notify, Divider,
  Popup, Radio, RadioGroup, Empty, Tag, Skeleton, Tabs,
  TabPane, ActionSheet, NoticeBar, Calendar, Picker, Steps, Step, Uploader, DatePicker,
  TextArea, Checkbox, Cascader, FixedNav, OverLay, Dialog, Card, Price, SearchBar, Image
} from '@nutui/nutui-taro';

import './app.scss'
import $mConfig from "@/services/index.config.js";
import http from "@/services/httpService.js";
import Taro from '@tarojs/taro';
import { NewFloraClient } from '@/apis/flora-api';
import store from './store';
const app = createApp({
  onShow(options) {
    console.log("onShow");
  },

  onLaunch() {
    console.log("onLaunch");
    let that = this;
    http.autoLogin(that.flora);
  },
  onLoad() {
    console.log("onLoad");
  },
  onReady() {
    console.log("onReady ");
  }
  // 入口组件不需要实现 render 方法，即使实现了也会被 taro 所覆盖
})


//全局参数挂载
app.config.globalProperties.$mConfig = $mConfig;

let components = [Button, Toast, Cell, CellGroup, Icon, Tabbar, TabbarItem, Swiper, SwiperItem,
  Grid, GridItem, InfiniteLoading, Layout, Row, Col, Switch, Avatar, Menu, MenuItem, Input,
  Form, FormItem, Sticky, Notify, Divider, Popup, Radio, RadioGroup, Empty, Tag, Skeleton,
  Tabs, TabPane, ActionSheet, NoticeBar, Calendar, Picker, Steps, Step, Uploader, DatePicker, TextArea,
  Checkbox, Cascader, FixedNav, OverLay, Dialog, Card, Price, SearchBar, Image
];

components.forEach(c => {
  app.use(c);
})

app.config.globalProperties.flora = NewFloraClient({
  floraBaseURL: $mConfig.baseUrl
})

export default app
